import settings
import importlib


def send_all(content):
    for path_str in settings.NOTIFY_LIST:
        # path_str = 'notify.email.Email'
        module_path, class_name = path_str.rsplit('.', maxsplit=1)
        # module_path = 'notify.email'
        # class_name = 'Email'
        # 1.利用字符串导入模块
        module = importlib.import_module(module_path)
        # 2. 利用反射获取类名
        cls = getattr(module, class_name)
        # 生成类的对象
        obj = cls()
        # 利用鸭子类型调用send方法
        obj.send(content)